1. Field of the Invention
The present invention relates to a method and apparatus for determining a rendering duration. More particularly, the method and apparatus is applied in an audio/video recording system, and it determines the rendering duration of a video frame based on various recording events.
2. Description of the Prior Art
Generally, a multimedia file includes a video bit stream and an audio bit stream. The video bit stream further includes a plurality of video frames, whereas the audio bit stream includes a plurality of audio frames. When the multimedia file is recorded, an audio/video recording system has to record the timing and order of each video frame of the video bit stream and the timing and order of each audio frame of the audio bit stream. When the multimedia file is requested to be rendered, an audio/video player renders the video frames and audio frames of the multimedia file according to the rendering time and order.
In addition, the audio/video recording system adopts the MPEG-4 standard and records the sequence and the rendering times of the video frames and the audio frames in a frame table (referring to international standard ISO/IEC 14496-1). Each video bit stream or audio bit stream has a corresponding frame table; each frame table includes at least one item, and each item further has two fields. Moreover, the first field of the item records a frame number, whereas the second field of the item records a frame duration. Furthermore, the frame duration is meant for a rendering duration of a video frame or an audio frame, whereas the frame number is meant for the number of series of video frames or audio frames which has the same frame duration. This shows that audio/video recording system adopting MPEG-4 standard records the relative timing information but not the absolute timing information of each audio/video frame.
FIG. 1A is an example of a multimedia file complied with the MPEG-4 standard. The multimedia file includes a multimedia header 101 and a multimedia data 102. Moreover, the multimedia header 101 includes a video frame table 103, whereas the multimedia data 102 includes a video bit stream 104 and an audio bit stream 124, and the video bit stream 104 further includes video frames 105 to 110.
FIG. 1B is an example of the video frame table 103. In the video frame table 103, each row means an item, and each item includes two fields: video frame number 111 and video frame duration 112. As shown in FIG. 1B, the first item 113 includes two fields (2, 33); that means, in the video bit stream 104 corresponding to the video frame table 103, the rendering duration of the video frame 105 and the video frame 106 are both equal to 33 time unit. Furthermore, the second item 114 includes two fields (1, 34); that means the rendering duration of the following video frame 107 is equal to 34 time unit. Additionally, the third item 115 includes two fields (2, 33); that means the rendering duration of the video frame 108 and the video frame 109 following the video frame 107 are both equal to 33 time unit.
FIG. 1C corresponds to the video frame table of FIG. 1B and shows the relative relationships between the rendering durations of video frames. In addition, the total rendering duration can be calculated based on the grand total of the number of the video frames and the duration of the video frames.
When an audio/video recording system records a multimedia file, various recording events may happen, such as, starting, resuming, stopping, pausing, frame loss, and audio/video synchronization correction. These recording events may cause an asynchronous error between a video bit stream and an audio bit stream of the multimedia file when the multimedia file is requested to play.
FIG. 2A and FIG. 2B show examples of the asynchronous error of an audio/video recorder caused by a paused recording event and a resumed recording event respectively in the prior art. In a MPEG-4 multimedia file recorded based on the audio/video recording system in the prior art, the duration of video frames and audio frames are both definite values. That is to say, the audio/video recording system records an audio frame with every period of time DA and records a video frame with every period of time DV.
FIG. 2A illustrates the relationship between audio frames and video frames as a paused recording event occurs. As shown in FIG. 2A, a paused recording event occurs at time TP; the last audio frame of the audio bit stream 210 is audio frame 211, and the total recording time of the audio bit stream 210 is 5DA. Moreover, when the paused recording event occurs, the last video frame of the video bit stream 212 is video frame 213, and the total recording time of the video bit stream 212 is 3DV. It should be noted that, the total recording time (5DA) of the audio bit stream 210 is not equal to the total recording time (3DV) of the video bit stream 212.
FIG. 2B illustrates the relationship between audio frames and video frames as a resumed recording event occurs. When the resumed recording event occurs, the first audio frame 214 is played at 5DA, whereas the first video frame 215 is displayed at 3DV. This phenomenon results in an asynchronous error between the video bit stream 212 and the audio bit stream 210; that is to say, a time difference (dT) of (3DV-5DA) occurs when the multimedia file is displayed.
Accordingly, a major objective of the invention is to provide a method and an apparatus for determining a rendering duration. More particularly, utilization of the method and apparatus of the invention to determine the rendering duration of video frames of a multimedia file can help to eliminate an asynchronous error between a video bit stream and an audio bit stream, so as to solve the asynchronous problem of video and audio signals when the multimedia file is displayed.